﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace IFPRJ.EF.Components.SkinEgine
{
    /// <summary>
    /// 支持皮肤的webform视图引擎。重写了视图路径的选取逻辑。
    /// </summary>
    public class SkinWebFormViewEngine : WebFormViewEngine
    {
        public SkinWebFormViewEngine() : this("default") { }
        public SkinWebFormViewEngine(string name)
        {
            MasterLocationFormats = new[] {
                "~/skins/" + name + "/{1}/{0}.cshtml",
                "~/skins/" + name + "/shared/{0}.cshtml"
            };
            ViewLocationFormats = new[] {
                "~/skins/" + name + "/{1}/{0}.cshtml",
                "~/skins/" + name + "/{1}/{0}.cshtml",
                "~/skins/" + name + "/shared/{0}.cshtml",
                "~/skins/" + name + "/shared/{0}.cshtml"
            };
            PartialViewLocationFormats = ViewLocationFormats;
        }
    }
}
